const http = require('../utils/http')

const HTTP = new http.HTTP()

// 获取商品列表
export function getGoodList(page, limit, callback) {
    let params = {
        pageNum: page,
        pageSize: limit,

    }
    HTTP.request('/manager/allGoods', 'GET', params, res => {
        callback(res)
    })
}

// 搜索商品
export function searchGood(keywords, pageNum, pageSize, callback) {
    let params = {
        keywords,
        pageNum,
        pageSize
    }
    HTTP.request('/goods/search', 'GET', params, res => {
        callback(res)
    })
}

// 查询所有礼品
export function goodsAllScoreExchange(params, callback) {
    HTTP.request(
        "/goods/getAllGift",
        "GET",
        params,
        res => callback(res)
    )
}
// 关键字查询礼品
export function getGoodsBySearch(GoodsName, pageNum, pageSize, callback) {
    let params = {
        GoodsName,
        pageNum,
        pageSize
    }
    HTTP.request('/goods/getGoodsBySearch', 'GET', params, res => {
        callback(res)
    })
}
export function getGiftBySearch(giftName, pageNum, pageSize, callback) {
    let params = {
        giftName,
        pageNum,
        pageSize
    }
    HTTP.request('/goods/getGiftBySearch', 'GET', params, res => {
        callback(res)
    })
}
